<%
# -*- mode: R -*-
  strategico.home <- as.character(Sys.getenv("STRATEGICO_HOME"))
  source(file.path(strategico.home, "strategico_util.R"))
    
  MySource("strategico_web.R")

  page.title <- " "
  page.sections	<- data.frame()

%>



<%
  b1 <- '

<script>
  function validateForm()
  {
    var x=document.forms["select_project_form"]["project"].value;
    if (x==null || x=="") {
      alert("Project name must be filled out");
      return false;
    }
    if (x==null || x=="") {
      alert("project name must be filled out");
      return false;
    }

    if (x.length > 10 ) {
      alert("Project name must be not more than 10 fields");
      return false;
    }

    var good_patt=new RegExp("^[a-z][a-z0-9]*$");
    if (!good_patt.test(x)) {
      alert("Project name must contain only lowercase letters and numbers. The first character must be a letter");
      return false;
    }
    return true;
  }
</script>

                <form name="select_project_form" method="GET" action="project.brew" onsubmit="return validateForm()">
                   <input name="project" type="text" value="changeme" size="10" />
        '

  b1 <- paste(b1, ' <input type="submit" name="set" value="Select project"/></form><br />')

  page.sections <- data.frame(title="Select project", body=b1)

  template.file <- file.path(GetWebTemplatesHome(), "page.brew")
  brew(template.file)
%>
